//
//  UIImage+Addition.h
//  Runone
//
//  Created by runone02 on 16/12/22.
//  Copyright © 2016年 runone. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AssetsLibrary/AssetsLibrary.h>

@interface UIImage (Addition)
+ (UIImage *)circleImageWithname:(NSString *)name
                     borderWidth:(CGFloat)borderWidth
                     borderColor:(UIColor *)borderColor;

/**
 *  保持宽高比设置图片在多大区域显示
 */
- (UIImage *)sourceImage:(UIImage *)sourceImage
              targetSize:(CGSize)targetSize;

/**
 *  指定宽度按比例缩放
 */
- (UIImage *)sourceImage:(UIImage *)sourceImage
             targetWidth:(CGFloat)targetWidth;

/**
 *  等比例缩放
 */
- (UIImage *)sourceImage:(UIImage *)sourceImage
                   scale:(CGFloat)scale;

+ (UIImage *)resizableImageWithImageName:(NSString *)imageName;

/** 压缩图片到指定的物理大小*/
- (NSData *)compressImageDataWithMaxLimit:(CGFloat)maxLimit;
- (UIImage *)compressImageWithMaxLimit:(CGFloat)maxLimit;

+ (UIImage *)imageWithColor:(UIColor *)aColor;
+ (UIImage *)imageWithColor:(UIColor *)aColor withFrame:(CGRect)aFrame;
+ (UIImage *)fullResolutionImageFromALAsset:(ALAsset *)asset;


/*
 *方法：拉伸图片
 *参数：imageName
 *参数：width
 *参数：height
 */
+ (UIImage *)stretchableImageName:(NSString *)imageName leftCapWidth:(NSInteger)width topCapHeight:(NSInteger)height;

/*
 *方法：拉伸图片
 *参数：image
 *参数：width
 *参数：height
 */
+ (UIImage *)stretchableImage:(UIImage *)image leftCapWidth:(NSInteger)width topCapHeight:(NSInteger)height;

@end
